#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QLabel>
#include <QStandardItemModel>
#include <QItemSelectionModel>

#include    "tspinboxdelegate.h"
#include    "tfloatspindelegate.h"
#include    "tcomboxdelegate.h"
#define FixedColumnCount 6

QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
private:
    TSpinbBoxDelegate   *intSpinDelegate;
    TFloatSpinDelegate *floatSpinDelegate;
    TComBoxDelegate  *comboDelegate;

    QLabel  *labCurFile;    //当前文件
    QLabel  *labCellPos;    //当前单元格行列号
    QLabel  *labCellText;   //当前单元格内容

    QStandardItemModel  *m_model;      //数据模型
    QItemSelectionModel *m_selection;  //Item选择模型

    void IniModelData(QStringList &aFileContent);

    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);

    ~MainWindow();

    void openDataFile(QString aFileName);

private slots:
    void do_currentChanged(const QModelIndex &current, const QModelIndex &previous);

    void on_actOpen_triggered();

    void on_actSave_triggered();

    void on_actAppend_triggered();

    void on_actInsert_triggered();

    void on_actDelete_triggered();

    void on_actModelData_triggered();

    void on_actAlignLeft_triggered();

    void on_actAlignCenter_triggered();

    void on_actAlignRight_triggered();



    void on_actFontBold_triggered(bool checked);

private:
    Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H
